﻿using System;
using System.Drawing;

namespace DemoGame_bird2._0
{
    /// <summary>
    /// 游戏对象：障碍物圆柱（上+下）
    /// </summary>
    class Barrier_Column
    {
        ///绘制圆柱
        public Rectangle Rectangle { get; set; }

        //定义向左运动的速度
        private int SpeedX;

        //定义上圆柱高度
        public int ColumnUpY { get; set; }
       
        //初始化
        public Barrier_Column(Rectangle rec,int columnY)
        {
            Rectangle=rec;
            SpeedX = -15;
            ColumnUpY = columnY;
        }



        //画图
        public void Draw(Graphics g)
        {
            //上圆柱
            Rectangle Rectangleup = new Rectangle(Rectangle.X, 0, 80, ColumnUpY);
            //下圆柱
            Rectangle Rectangledown = new Rectangle(Rectangle.X, ColumnUpY+150, 80, 450-ColumnUpY);

            //上圆柱的图片
            g.DrawImage(Properties.Resources.up, Rectangleup);
            //下圆柱的图片
            g.DrawImage(Properties.Resources.down, Rectangledown);
           
        }
        


        //一组圆柱的移动
        public void Move()
        {           
            this.Rectangle = new Rectangle(this.Rectangle.X + SpeedX,
                                           0, 
                                           Rectangle.Width, 
                                           Rectangle.Height);

        }
        
        
    }
}
